<div class="grid-24">
  <?php if (Yii::app()->user->hasFlash('success')): ?>
    <div class="notify notify-success">
      <a href="javascript:;" class="close">×</a>
      <?php echo Yii::app()->user->getFlash('success'); ?>
    </div>
  <?php endif; ?>

  <?php
  $this->renderPartial('_search', array(
      'model' => $searchModel,
      'searchData' => $searchData
  ));
  ?>

  <div class="widget widget-table">
    <div class="widget-header">
      <span class="icon-list"></span>
      <h3 class="icon chart"><?php echo Yii::t('main', 'category.list_title'); ?></h3>

    </div>

    <div class="widget-content">
      <div class="dataTables_wrapper">
        <div class="fg-toolbar ui-toolbar ui-widget-header ui-corner-tl ui-corner-tr ui-helper-clearfix">
          <div class="dataTables_filter">
            <?php if (Constants::isAdmin()) : ?>
            <a href="<?php echo Yii::app()->createUrl('admin/sites/create'); ?>" >
              <button class="btn btn-small btn-success">
                <span class="icon-plus"></span><?php echo Yii::t('main', 'button.add'); ?>
              </button>
            </a>
            <?php endif;?>
          </div>
        </div>
        <div style="width: 990px;overflow-x: scroll;">

        <table class="table table-bordered table-striped" <?php if (Constants::isAdmin()) : ?>style="width: 250%" <?php endif;?>>
          <thead>
            <tr>
              <?php if (Constants::isAdmin()) : ?>
              <th class="" width="1.5%">
                <?php echo CHtml::link(Yii::t('main', 'header.stt'), 'javascript:void(0)', array('class' => 'float_left')); ?>
              </th>

              <th class="" width="4%">
                <?php echo $sort->extLink('sitename', "SiteName", array('class' => 'float_left')); ?>
              </th>
              <th class="" width="">
                <?php echo $sort->extLink('site_url', "Site URL", array('class' => 'float_left')); ?>
              </th>
              <th class="" width="3%">
                <?php echo $sort->extLink('status', "Status", array('class' => 'float_left')); ?>
              </th>

              <th class="" width="4%">
                <?php echo $sort->extLink('has_captcha', "Captcha", array('class' => 'float_left')); ?>
              </th>
              <th class="" width="6%">
                <?php echo $sort->extLink('login_url', "Login Url", array('class' => 'float_left')); ?>
              </th>
              <th class="" width="">
                <?php echo $sort->extLink('account_url', "Account Url", array('class' => 'float_left')); ?>
              </th>
              <th class="" >
                <?php echo $sort->extLink('ad_url', "Ad Url", array('class' => 'float_left')); ?>
              </th>
              <th class="" >
                <?php echo $sort->extLink('grid_url', "Grid Url", array('class' => 'float_left')); ?>
              </th>

              <th class="" >
                <?php echo $sort->extLink('captcha_login_url', "Cap Login Url", array('class' => 'float_left')); ?>
              </th>
              <th class="" width="4%">
                <?php echo $sort->extLink('captcha_login_img_ex', "Login Ex", array('class' => 'float_left')); ?>
              </th>
              <th class="" >
                <?php echo $sort->extLink('captcha_ad_url', "Cap Ad Url", array('class' => 'float_left')); ?>
              </th>
              <th class="" width="3%">
                <?php echo $sort->extLink('captcha_ad_img_ex', "Ad Ex", array('class' => 'float_left')); ?>
              </th>

              <th class="" width="">
                <?php echo "Money Xpath"; ?>
              </th>
              <th class="" width="4%">
              </th>
              <?php else : ?>
              <th class="" width="15%">
                <?php echo $sort->extLink('sitename', "SiteName", array('class' => 'float_left')); ?>
              </th>
              <th class="" width="">
                <?php echo $sort->extLink('site_url', "Site URL", array('class' => 'float_left')); ?>
              </th>
              <th class="" width="10%">
                <?php echo $sort->extLink('status', "Status", array('class' => 'float_left')); ?>
              </th>s
              <?php endif;?>
            </tr>
          </thead>
          <tbody>
            <?php $i = 1; ?>
            <?php foreach ($models as $model): ?>
              <tr class="gradeA">
                <?php if (Constants::isAdmin()) : ?>
                <td><?php echo $model->site_id; ?></td>
                <?php endif;?>
                <td>
                    <a href="<?php echo Yii::app()->createUrl('admin/sites/update', array('id' => $model->site_id) + $_GET); ?>">
                        <?php echo CHtml::encode($model->sitename); ?>
                    </a>
                </td>
                <td class="center"><?php echo CHtml::encode($model->site_url); ?></td>
                <td class="text_center"><?php echo $statusList[$model->status]; ?></td>
                <?php if (Constants::isAdmin()) : ?>
                <td class="text_center"><?php if ($model->has_captcha) echo 'Yes'; else echo 'No';  ?></td>
                <td class=""><?php echo CHtml::encode($model->login_url); ?></td>
                <td class=""><?php echo CHtml::encode($model->account_url); ?></td>
                <td class=""><?php echo CHtml::encode($model->ad_url); ?></td>
                <td class=""><?php echo CHtml::encode($model->grid_url); ?></td>

                <td class=""><?php echo CHtml::encode($model->captcha_login_url); ?></td>
                <td class="text_center"><?php echo CHtml::encode($model->captcha_login_img_ex); ?></td>
                <td class=""><?php echo CHtml::encode($model->captcha_ad_url); ?></td>
                <td class="text_center"><?php echo CHtml::encode($model->captcha_ad_img_ex); ?></td>

                <td class=""><?php echo CHtml::encode($model->money_xpath); ?></td>
                <td class="">
                  <button class="btn btn-small btn-error" type="button" onclick="return categoryPage.remove('<?php echo Yii::app()->createUrl('admin/sites/delete', array('id' => $model->site_id)); ?>')">
                    <span class="icon-minus"></span><?php echo Yii::t('main', 'button.delete'); ?>
                  </button>
                </td>
                <?php endif;?>
              </tr>
              <?php $i++; ?>
            <?php endforeach; ?>
          </tbody>
        </table>

        </div>
        <?php $this->renderPartial('../units/_pager', array('pages' => $pages, 'countData' => count($models))); ?>
      </div>
    </div>
    <!-- .widget-content -->

  </div>
  <!-- .widget -->

</div>

<?php
$cs = Yii::app()->getClientScript();
$cs->registerScriptFile(Yii::app()->baseUrl . '/js/sites.js');
?>